import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from "@/pages/Home.vue";
import About from "@/pages/About.vue";
import FilmList from "@/pages/FilmList.vue";
import NewsList from "@/pages/NewsList.vue";
import Detail from "@/pages/Detail.vue";
Vue.use(VueRouter)

const routes = [
  {
    path: '/about',
    component: About,
  },
  {
    path: '/home',
    component: Home,
    children:[
      {
        path:'/home/films',
        component:FilmList,
        children:[
          {
            path:':id',
            component:Detail
          }
        ]
      },
      {
        path: '/home/news',
        component: NewsList
      },
      {
        path: '/home',
        redirect:'/home/films'
      }
    ]
  },
  {
    path: '/',
    redirect:'/home'
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
